import random
import time
import os
import webbrowser

turl = r'https://home.changan.com.cn/share/#/info_details?id=156910&sharer=92868'
def flush_pv(turl):
        webbrowser.open(turl, new=0, autoraise=True)
        time.sleep(2)
        # Google浏览器
        # os.system('taskkill /F /IM chrome.exe')
        # # 火狐浏览器
        # os.system('taskkill /F /IM firefox.exe')
        # # edge浏览器
        # os.system('taskkill /F /IM msedge.exe')
        time.sleep(1)
        os.system('taskkill /F /IM msedge.exe')
# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
    threads = list()
    for i in range(1000):
    #     t = threading.Thread(target=flush_pv, args=(turl,))
    #     threads.append(t)
    #     t.start()
    # for t in threads:
    #     t.join()
        print('第',i,'次')
        flush_pv(turl)
        pause_seconds = random.randint(5,60)
        print("睡眠",pause_seconds,'秒')
        time.sleep(pause_seconds)
    print("执行结束")
